using Data;
using Framework.Audio;
using UnityEngine;

public class GameCubeReceiver : GameCube
{

    private bool        isFrist;
    private LightVector lastVector;
    public  GameObject  LightObj;

    public override void Pool_Enable()
    {
        this.isFrist = true;
        this.isLight = false;
        this.LightObj.SetActive(false);
        base.Pool_Enable();
    }

    public override void OnInLight(LightVector lightVector)
    {
        if (this.isLight == false)
        {
            if (this.isFrist)
            {
                this.isFrist = false;
                AudioManager.Instance.PlaySound("Game_Active");
                this.lastVector = lightVector;
            }
            else if (this.lastVector != lightVector)
            {
                AudioManager.Instance.PlaySound("Game_Active");
                this.lastVector = lightVector;
            }
            // GameManager.Instance.GameRoom.SetReceiverCount(1);
            this.LightObj.SetActive(true);
            this.isLight = true;
        }

        base.OnInLight(lightVector);
    }

    public override void OnCloseLight()
    {
        if (this.isLight)
        {
            this.LightObj.SetActive(false);
            // GameManager.Instance.GameRoom.SetReceiverCount(-1);
            // Debug.Log("");
        }
        base.OnCloseLight();
    }

}